/**
 * 类 class
 */

class User {
    // 静态属性
    static host = "http://www.baidu.com";
    static _host = "https://www.souhu.com"; // 使用_自定义保护属性
    constructor (name, age) {
        this.name = name;
        this.age = age;
    }

    getName() {
        return this.name;
    }

    // 静态方法
    static staticCreateFunc (...args) {
        return new this(...args);
    }
}

let user = new User("哇哈哈", 19);
console.log(user.name);
console.log(user.getName());
console.log(User.staticCreateFunc("可口可乐", 18)); // User { name: '可口可乐', age: 18 }
